package com.dognessnetwork.operation.baseservice;

import java.util.List;

import org.springframework.data.domain.Pageable;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Service;

import com.dognessnetwork.operation.ops.domain.Messages;

@Service
public interface MessagesService {

	public abstract Messages	save(Messages	messages);
	
	public abstract Messages	findById(@Param("id")Long id);
	/**
	 * 获取未回复的用户
	 * @param sender
	 * @return
	 */
	public	abstract	List<Object>	getUserList(boolean	sender);
	
	/**
     * 获取用户问题
     * @param userIdCard
     * @return
     */
	public	abstract	List<Object[]>	getMessagesByUserIdCard(@Param("userIdCard")String	userIdCard);
	
	/**
	 * 查询历史消息
	 * @param userIdCard
	 * @return
	 */
	public	abstract	List<Messages>	getMessageHistory(String	userIdCard,Pageable	pageable);

	/**
	 * 通过id更新消息为收到
	 * @param id
	 * @param receiveTime
	 * @return
	 */
	public	abstract	int	queryMessagesById(@Param("id") Long id,@Param("receiveTime") String receiveTime);

	/**
	 * 查询有关用户消息总条数
	 * @param userIdCard
	 * @return
	 */
	public abstract int findMessageCountByUserIdCard(String userIdCard);
	
	/**
	 * 获取用户最后一条信息的id
	 * @param userIdCard
	 * @return
	 */
	public abstract int queryMaxMessageId(String userIdCard);
	
	/**
     * 轮询获取回复
     * @param id
     * @param userIdCard
     * @return
     */
	public	abstract	List<Messages>	getAnswer(@Param("id") Long id,@Param("userIdCard")String	userIdCard);
}
